home *** CD-ROM | disk | FTP | other *** search
- Path: newsbf02.news.aol.com!not-for-mail
- From: awhang8367@aol.com (AWhang8367)
- Newsgroups: comp.lang.c++
- Subject: === Repost : Interrupt driven object ===
- Date: 17 Jan 1996 09:11:40 -0500
- Organization: America Online, Inc. (1-800-827-6364)
- Sender: root@newsbf02.news.aol.com
- Message-ID: <4dj02s$60q@newsbf02.news.aol.com>
- Reply-To: awhang8367@aol.com (AWhang8367)
- NNTP-Posting-Host: newsbf02.mail.aol.com
-
-
- >In article <4d6imm$okq@newsbf02.news.aol.com>, awhang8367@aol.com says...
- >
- > I have been struggling to create an object that handles hardware
- >interrupt directly. Particularly with the setvect function as it takes
- in
- >pointers to interrupts
- >and not to objects. Two things I can do (and I have accomplished ther
- >former):
- >
- > 1) Use an interrupt service routine to call the object.
- > 2) directly write the address of the member function to the Interrupt
- >vector table
- >
- > Both implementations seems to be very clumsy. Does anyone know of a
- >good way of doing it? Any pointer or email interrupt will be greatly
- >appreciated.
- >
- > =======================================================
-
-
- This is a repost of the above question.
-
- Platform : MS-DOS
- Compiler : BC++ 4.52
- Objective : To create an object that intercepts interrupt
- Problem : Unable to use setvect() to point interrupt to
- objects "member interrupt function".
- The following code illustrates:
-
- class serial_device:public UART
- {
- private :
- .
- .
- .
- .
-
- public :
- void interrupt far isr(...);
- serial_device()
- {
- .
- .
- .
- setvect(0xb,isr);
-
- // The above line causes these error messages :
- // 1) Error SOURCE\SERIAL.CPP 79: Member function
- // must be called or its address taken in function
- // serial_device::serial_device()
- //
- // 2) Error SOURCE\SERIAL.CPP 79: Type mismatch in
- // parameter '__isr' in call to 'setvect(int,void (interrupt
- *)(...))'
- // in function serial_device::serial_device()
- //
- // Also tried using the following to no avail :
- //
- // setvect(0xb,&serial_device::isr)
- // setvect(0xb,(interrupt*)&serial_device::isr)
- //
- }
-
- ~serial_device(){};
- {
- .
- .
- .
- }
-
- };
-
-
- // ===============================================
- Referring to my original posting the first
- method looks like this:
-
- class serial_device:public UART
- {
- private :
- .
- .
- .
- .
-
- public :
- void isr();
- serial_device()
- {
- .
- .
- .
- }
-
- ~serial_device(){};
- {
- .
- .
- .
- }
-
- };
-
- serial_device Scanner;
-
- void interrupt far interrupt_isr(...)
- {
- asm sti;
- Scanner.isr();
- outp(0x20,0X20) ;
- }
-